package lesson15;

import java.util.Arrays;

class Person 
{
	String name;
	short age;
	String perosnalNumber;
	char sex;
	double weight;
	Person[] friends;
	int number;
	int healthStatus = 50;// from 0 to 100
	int starvationSatus = 50;//from 0 to 100
	int mentalStatus = 50;//form 0 to 100
	double bankAccount = 100000;
	Car car;
	double priceMetal = 0.33;
	void buyCar(Car car)
	{
		if(this.bankAccount >= car.price)
		{
			this.car = car;
			car.changeOwner(this);
		}
	}
	double sellCarForScrap()
	{
		double returnedMoney = car.calculateCarPriceForScrap(priceMetal);
		this.bankAccount += returnedMoney;
		return this.bankAccount;
		
	}
	void printPerson()
	{
		System.out.println("Name: " + this.name);
		System.out.println("The current age: " + this.age);
		System.out.println("Sex: " + this.sex);
		System.out.println("Weight: " + this.weight);
		System.out.println("Friends: " + Arrays.toString(this.friends));
		System.out.println("Personal number: " + this.perosnalNumber);
		
		
	}
	Person()
	{
		this.age = 0;
		this.weight = 4.0;
	}
	Person(String name, String personalNumber, boolean isMale)
	{
		this();
		this.name = name;
		this.perosnalNumber = personalNumber;
		if(isMale)
		{
			sex = 'm';
		}
		else 
		{
			sex = 'f';
		}
		friends = new Person[3];
	}
	void eat(int foodVolume)
	{
		if(starvationSatus+foodVolume >= 100)
			starvationSatus = 100;
		else
			starvationSatus += foodVolume;
	}
	void walk()
	{
		System.out.println(name + " is walking");
		starvationSatus-=5;
	}
	void growup()
	{
		age++;
	}
	void drinkWater(double litres)
	{
		System.out.println(name + " is drinking" + litres + " litres ogf water");
		starvationSatus +=10;
	}
	Person(String personName, short i)
	{
		name = personName;
		age = i;
	}
}
